<%@page contentType="text/html" language="java" import="com.compuvest.web.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<jsp:useBean id="advertArray" class="AdvertArray" scope="application"/>
<jsp:useBean id="sb" class="MySQL" scope="application"/>
<%
    java.text.DecimalFormat priceForm = new java.text.DecimalFormat("$#,##0.00");

    String countryCode = advertArray.getString(request.getParameter("CountryCode"), "US");
    String zipCode = advertArray.getString(request.getParameter("ZipCode"), "");
    double weight = advertArray.getDouble(request.getParameter("weight"), 0d);
%>
<html>
<head></head>
<body style="font-family:Microsoft Sans Serif;font-size:9.5pt;color:#000066;margin:5px 5px 0px 5px;background-color:#FFFFE1;">

<%
    // not show if zipCode=empty
    if(!"".equals(zipCode) || !"US".equals(countryCode) || weight != 0d) {

	java.util.List<ShipRate> shippRate = null;
	if("US".equals(countryCode))
	    shippRate = sb.getShippingChartUS(zipCode, weight);
	else
	    shippRate = sb.getShippingChart(countryCode, weight);

	if(shippRate.size() != 0) {
	    StringBuilder rdo = new StringBuilder(100);
	    for(ShipRate ship : shippRate) {
		rdo.append(priceForm.format(ship.getShipPrice())).append(" - ").append(ship.getDescription()).append("<br/>");
	    }
	    out.write(rdo.toString());
	}
    }

%>

</body>
</html>
